package com.clever.mall.mapper;

import com.clever.mall.entity.Order;
import com.clever.mall.vo.IsOrderVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface OrderMapper {

    /**
     * 通过用户id查询用户所有订单
     * @param uid
     * @return
     */
    List<Order> selectOrderAll(@Param("uid") int uid);

    /**
     * 通过用户id和状态码查询用户订单
     * @param uid
     * @return
     */
    List<Order> selectOrderListByStatus(@Param("uid") int uid, @Param("status") String status);

    /**
     * 通过订单id查询用户订单详情
     * @param oid
     * @return
     */
    Order selectOrderByOrderId(@Param("oid") int oid);

    /**
     * 添加单个订单
     * @param order
     * @return
     */
    int insertOrder(@Param("order")Order order);

    int insertOrderList(@Param("orderList") List<Order> orderList);

    /**
     * 通过订单id删除订单
     * @param orderId
     * @return
     */
    int deleteOrderByOrderId(@Param("orderId") int orderId);

    int deleteOrderListByOrderListId(@Param("oidList") List<Integer> oidList);

    /**
     * 修改订单状态
     * @param orderId
     * @param status
     * @return
     */
    int updateOrderStatus(@Param("orderId") int orderId, @Param("status") int status);

    /**
     * 修改订单退款状态
     * @param orderId
     * @param refundStatus
     * @return
     */
    int updateOrderRefundStatus(@Param("orderId") int orderId, @Param("refundStatus") int refundStatus);

    //IsOrderVo selectIsOrderVoByUserIdAndProductId(@Param("uid") int uid, @Param("pid") String pid);

}
